//
//  NSError+LTError.m
//  fmb
//


#import "NSError+LTError.h"

@implementation NSError (LTError)

- (BOOL)lt_isNetworkError
{
  NSInteger code = self.code;
  if(code == LTErrorCodeNetworkError) return YES;
  return NO;
}

- (BOOL)lt_isBadRequest
{
  NSInteger code = self.code;
  if(code == LTErrorCodeBadRequest || code == 300000 || code == 100001) return YES;
  return NO;
}

- (NSString *)lt_userMessage
{
  if([self lt_isNetworkError]){
    return @"网络不给力";
  }else if([self lt_isBadRequest]){
    return @"接口错误";
  }
  return self.localizedDescription;
}

@end
